package g4p.tests;

import java.io.File;

import g4p_controls.G4P;
import g4p_controls.GButton;
import g4p_controls.GCScheme;
import g4p_controls.GEvent;
import g4p_controls.GLabel;
import g4p_controls.GTextArea;
import g4p_controls.GTextField;
import processing.core.PApplet;

public class EmptyTextField extends PApplet {

	public void setup(){
		size(480, 320, JAVA2D);
		createGUI();
		customGUI();
		// Place your setup code here

	}

	public void draw(){
		background(230);
		System.out.println(textfield1.hasFocus() + "  " + textfield1.hasSelection() + millis());
	}

	// Use this method to add additional statements
	// to customise the GUI controls
	public void customGUI(){

	}



	public void getfilenamehandler(File selection)
	{
		if (selection != null)
		{
			textfield1.setText(selection.getAbsolutePath());
			label1.setText(selection.getAbsolutePath());
		}
	}

	public void textfield1_change1(GTextField source, GEvent event) { //_CODE_:textfield1:831734:

	} //_CODE_:textfield1:831734:

	public void button1_click1(GButton source, GEvent event) { //_CODE_:button1:560015:
		selectInput("Thanks quark!", "getfilenamehandler");
	} //_CODE_:button1:560015:

	// Create all the GUI controls.
	// autogenerated do not edit
	public void createGUI(){
		G4P.messagesEnabled(false);
		G4P.setGlobalColorScheme(GCScheme.BLUE_SCHEME);
		G4P.setCursor(ARROW);
		if(frame != null)
			frame.setTitle("Sketch Window");
		button1 = new GButton(this, 200, 40, 80, 30);
		button1.setText("Face text");
		button1.addEventHandler(this, "button1_click1");
		textfield1 = new GTextField(this, 20, 80, 440, 30, G4P.SCROLLBARS_NONE);
		textfield1.setOpaque(true);
		textfield1.addEventHandler(this, "textfield1_change1");
		label1 = new GLabel(this, 20, 120, 440, 20);
		label1.setText("My label");
		label1.setOpaque(false);
		textarea1 = new GTextArea(this, 20, 160, 440, 100, G4P.SCROLLBARS_NONE);
		textarea1.setOpaque(true);
		textarea1.addEventHandler(this, "textarea1_change1");
	}

	// Variable declarations
	// autogenerated do not edit
	GTextField textfield1;
	GTextArea textarea1;
	GButton button1;
	GLabel label1; 

}
